﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>南京化工职业技术学院资源共享平台</title>
<link href="<%=basePath%>res/css/css.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<%=basePath%>res/js/util.js"></script>
<script type="text/javascript">
	function checkUpload() {
		if(${user == null}) {
			alert("请在登录后上传文件！");
			<%
				//0 is default share type
				session.setAttribute("shareType", "0");
			%>
			window.location.href="<%=basePath%>login.jsp?refreshurl=upload.jsp";
		} else {
			window.location.href="<%=basePath%>upload.jsp";
		}
	}
	
	function download(id) {
		if(confirm("确定要下载该资源吗？")) {
			window.location.href="<%=basePath%>njcc/download.action?id=" + id;
		}
	}
	
	function checkReview() {
		if(${empty user}) {
			alert("请先登录！");
			return false;
		}
		if(document.getElementById("comment").value == null || jmz.GetLength(document.getElementById("comment").value) == "") {
			alert("请填写评论！");
			return false;
		}
		return true;
 	}
</script>
</head>
<body>
<div id="header">
   <div id="top">
       <ul>
            <li><marquee onmouseover=this.stop() onmouseout=this.start()>今日访问：${accessCount }&nbsp;&nbsp;共享资源总数：${resCount }&nbsp;&nbsp;注册用户总数：${userCount }&nbsp;&nbsp;资源共享达人：${daUser.realName }&nbsp;&nbsp;资源下载热度：${faRes.name }</marquee></li>
       </ul>
   </div>
   <div id="bottom">
       <div id="bleft"><img src="<%=basePath%>res/images/share_05.jpg" width="387" height="65" />
       </div>
       <div id="bright">
            <ul>
            	<c:if test="${empty user}">
                 <li><a href="javascript:window.location.href='<%=basePath%>login.jsp?refreshurl=entry.jsp';"><img src="<%=basePath%>res/images/share_08.jpg" width="31" height="18" /></a>&nbsp;&nbsp;
                 	<a href="javascript:window.location.href='<%=basePath%>register.jsp?refreshurl=entry.jsp';"><img src="<%=basePath%>res/images/share_1.jpg" width="31" height="18" /></a>&nbsp;&nbsp;
                 	<a href="javascript:window.location.href='<%=basePath%>retrieve.jsp';">忘记密码？</a>
                 </li>
                 </c:if>
            	<c:if test="${!empty user}">
                 <li>
                 	<h2>${user.realName }，欢迎回来！</h2><h2><a href="<%=basePath%>njcc/loadUserInfo.action" style="color:red;">个人中心，</a></h2>&nbsp;&nbsp;<h2><a href="<%=basePath%>njcc/logout.action">点击退出！</a></h2>
                 </li>
                 </c:if>
            </ul>
       </div>
   </div>
</div>
<div id="content">
     <div id="cleft">
          <div id="sc"><a href="javascript:checkUpload();"><img src="<%=basePath%>res/images/share_03.jpg" width="192" height="58" /></a>
          </div>
          <div id="dh">
                <div id="dhtop">
                </div>
                <div id="dhc">
                    <ul>
                    	<c:choose>
                    		<c:when test="${empty types}">
                        		<h1 class="font1">暂无数据</h1>
                    		</c:when>
                    		<c:otherwise>
                    			<c:forEach items="${types}" var="typesObj" varStatus="i">
                    				<div style="height:10px;"></div>
                        			<h1 class="font1"><a href="<%=basePath%>njcc/loadRes.action?type=${typesObj.id }">${typesObj.name }</a></h1>
                        			<c:if test="${i.index == 0}">
                        				<c:choose>
				                    		<c:when test="${empty typelist1}">
				                        		<li class="font1">暂无数据</li>
				                    		</c:when>
				                    		<c:otherwise>
				                    			<c:forEach items="${typelist1}" var="typelist1Obj" varStatus="j">
				                    				<c:if test="${j.index % 2 == 0}">
				                    					<li><div style="width:60px;float:left;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></div>|
				                    				</c:if>
				                    				<c:if test="${j.index % 2 != 0}">
				                    					<div style="width:60px;float:right;padding-right:20px;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></li>
				                    				</c:if>
				                    			</c:forEach>
				                    		</c:otherwise>
                        				</c:choose>
                        			</c:if>
                        			<c:if test="${i.index == 1}">
                        				<c:choose>
				                    		<c:when test="${empty typelist2}">
				                        		<li class="font1">暂无数据</li>
				                    		</c:when>
				                    		<c:otherwise>
				                    			<c:forEach items="${typelist2}" var="typelist1Obj" varStatus="j">
				                    				<c:if test="${j.index % 2 == 0}">
				                    					<li><div style="width:60px;float:left;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></div>|
				                    				</c:if>
				                    				<c:if test="${j.index % 2 != 0}">
				                    					<div style="width:60px;float:right;padding-right:20px;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></li>
				                    				</c:if>
				                    			</c:forEach>
				                    		</c:otherwise>
                        				</c:choose>
                        			</c:if>
                        			<c:if test="${i.index == 2}">
                        				<c:choose>
				                    		<c:when test="${empty typelist3}">
				                        		<li class="font1">暂无数据</li>
				                    		</c:when>
				                    		<c:otherwise>
				                    			<c:forEach items="${typelist3}" var="typelist1Obj" varStatus="j">
				                    				<c:if test="${j.index % 2 == 0}">
				                    					<li><div style="width:60px;float:left;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></div>|
				                    				</c:if>
				                    				<c:if test="${j.index % 2 != 0}">
				                    					<div style="width:60px;float:right;padding-right:20px;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></li>
				                    				</c:if>
				                    			</c:forEach>
				                    		</c:otherwise>
                        				</c:choose>
                        			</c:if>
                        			<c:if test="${i.index == 3}">
                        				<c:choose>
				                    		<c:when test="${empty typelist4}">
				                        		<li class="font1">暂无数据</li>
				                    		</c:when>
				                    		<c:otherwise>
				                    			<c:forEach items="${typelist4}" var="typelist1Obj" varStatus="j">
				                    				<c:if test="${j.index % 2 == 0}">
				                    					<li><div style="width:60px;float:left;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></div>|
				                    				</c:if>
				                    				<c:if test="${j.index % 2 != 0}">
				                    					<div style="width:60px;float:right;padding-right:20px;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></li>
				                    				</c:if>
				                    			</c:forEach>
				                    		</c:otherwise>
                        				</c:choose>
                        			</c:if>
                        			<c:if test="${i.index == 4}">
                        				<c:choose>
				                    		<c:when test="${empty typelist5}">
				                        		<li class="font1">暂无数据</li>
				                    		</c:when>
				                    		<c:otherwise>
				                    			<c:forEach items="${typelist5}" var="typelist1Obj" varStatus="j">
				                    				<c:if test="${j.index % 2 == 0}">
				                    					<li><div style="width:60px;float:left;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></div>|
				                    				</c:if>
				                    				<c:if test="${j.index % 2 != 0}">
				                    					<div style="width:60px;float:right;padding-right:20px;"><a href="<%=basePath%>njcc/loadRes.action?type=${typelist1Obj.id }">${typelist1Obj.name }</a></li>
				                    				</c:if>
				                    			</c:forEach>
				                    		</c:otherwise>
                        				</c:choose>
                        			</c:if>
                    			</c:forEach>
                    		</c:otherwise>
                    	</c:choose>
                  </ul>
                </div>
                <div id="dhbottom"><img src="<%=basePath%>res/images/left_08.jpg" width="192" height="16" />
                </div>
          </div>
     
     </div>
  <div id="cright">
                
                	<div id="location"><a class="blue" href="<%=basePath%>">首页</a>
				    	<span class="blue"> >> </span><a class="blue" title="${type.name }">${type.name }</a>
				    </div>

         <!--正文开始 -->
			 <div id="all-source">
                	<div class="list-title"><strong >${info.info.name}</strong></div>
                	<c:if test="${empty info.info.iconUrl}">
                		<img src="<%=basePath%>res/images/no.gif" width="120" height="100" />
                	</c:if>
                	<c:if test="${!empty info.info.iconUrl}">
                		<img src="<%=basePath%>${info.info.iconUrl }" width="120" height="100" />
                	</c:if>
                    <p class="txt-left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${info.info.summary }</p>
         <!--正文结束 -->
	</div>
        <div class="pager1">
        	<br/>
             <a href="javascript:download(${info.info.id });"><img src="<%=basePath%>res/images/download.gif"/></a><a style="color:gray;">(下载所需积分：${info.info.reqPoint }，已被下载${info.info.downloadCount }次)</a>
        </div>
        <form action="<%=basePath%>njcc/review.action?resId=${info.info.id }" method="post" onsubmit="javascript:return checkReview();">
        <div class="inbox" >
          <div class="hd">
          <h2>用户评论：</h2>
          <div class="hasCom"><a href="<%=basePath%>njcc/getReviews.action?resId=${info.info.id }" >已有${reviewCount }条评论，共${reviewCount }人参与，点击查看</a></div>
          <div class="bd">
			<ul id="ComList">
			</ul>
		  </div>
          <div class="ft">
            <textarea id="comment" name="comment" cols="" rows="" ></textarea>
          </div>
          </div>
          <div class="commt-sub"> 
          <span id="cmt_login_btn">
          	<c:if test="${empty user}">
          		<a href="<%=basePath%>login.jsp?refreshurl=njcc/loadResItem.action?id=${id }"><strong>登录</strong></a> (请登录发言)
          	</c:if>
          	<c:if test="${!empty user}">
          		<a style="color:green;">${user.loginName}</a>
          	</c:if>  
          	</span>
               <input type="submit" value="发表评论" class="submit" />
          </div> 
          </form>          
    </div>
  </div>
</div>
<div id="guanggao1" style="margin-bottom:5px;"><img src="<%=basePath%>res/images/share_44.jpg" width="900" height="95" /></div>
<div id="banquan">
           <ul>
                 <li>南京化工职业技术学院--资源共享网 <img src="<%=basePath%>res/images/pic.gif" width="50" height="12" /></li>           
                 <li>诚聘英才 | 友情链接 | 联系我们</li> 
                 <li>版权所有©南京化工职业技术学院 ICP：沪B2-20030192 </li>
  </ul>
</div>
</body>
</html>
